/**
 * Copyright (C) 2019 Baidu, Inc. All Rights Reserved.
 */
package com.bailiban.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.bailiban.domain.Account;
import com.bailiban.service.AccountService;

/**
 * 类说明:账户
 * 
 * @author zl
 * @version 创建时间：2019年12月10日 上午10:32:35
 * @Company http://www.bailiban.com
 */
@Controller
@RequestMapping("/account")
public class AccountController {
    @Autowired
    private AccountService aService;

    // 展示账户
    @RequestMapping("/findAll.do")
    public ModelAndView showAccount() {
        List<Account> list = aService.findAll();
        ModelAndView view = new ModelAndView();
        view.addObject("accountList", list);
        view.setViewName("show-account");
        return view;

    }

    @RequestMapping("/save.do")
    public String save(Account account) {
        // 保存
        aService.save(account);

        return "redirect:/account/findAll.do";

    }
}
